// api/discuss.js - 评论相关API
import request from '@/utils/request';

// 获取讨论列表
export const getDiscussionList = (params) => {
  return request({
    url: '/discuss/list',
    method: 'get',
    params
  });
};

// 获取讨论详情
export const getDiscussionDetail = (params) => {
  return request({
    url: '/discuss/detail',
    method: 'get',
    params
  });
};

// 创建讨论
export const createDiscussion = (data) => {
  return request({
    url: '/discuss/create',
    method: 'post',
    data
  });
};

// 添加评论
export const addComment = (data) => {
  return request({
    url: '/discuss/comment',
    method: 'post',
    data
  });
};

// 获取评论列表
export const getCommentList = (params) => {
  return request({
    url: '/discuss/comments',
    method: 'get',
    params
  });
};

// 点赞评论
export const likeComment = (data) => {
  return request({
    url: '/discuss/comment/like',
    method: 'post',
    data
  });
};

// 删除评论
export const deleteComment = (data) => {
  return request({
    url: '/discuss/comment/delete',
    method: 'delete',
    data
  });
};

// 获取评论详情
export const getCommentDetail = (params) => {
  return request({
    url: '/discuss/comment/detail',
    method: 'get',
    params
  });
};

// 点赞讨论
export const likeDiscussion = (data) => {
  return request({
    url: '/discuss/like',
    method: 'post',
    data
  });
};